package com.xxx.video.dynamic.presenters;

import android.content.Context;

import androidx.annotation.NonNull;

import com.xxx.video.commen.beans.BaseBean;
import com.xxx.video.commen.presenters.BasePresenter;
import com.xxx.video.commen.utils.ResponseUtils;
import com.xxx.video.dynamic.beans.OutFriendsListBean;
import com.xxx.video.network.listeners.CommonResponseListener;
import com.xxx.video.network.utils.NetWorkUtils;

public class MySendFriendRequestPresenter extends BasePresenter<IMySendFriendRequestView> {

    public MySendFriendRequestPresenter(@NonNull Context context, IMySendFriendRequestView baseView) {
        super(context, baseView);
    }

    /**
     * get out friend list
     */
    public void getOutFriendsList() {
        NetWorkUtils.getInstance().getOutFriendsList(new CommonResponseListener<OutFriendsListBean>() {
            @Override
            public void onSuccess(OutFriendsListBean successOb, String result) {
                if (ResponseUtils.getInstance().isNoError(successOb)) {
                    if (getBaseView() != null) {
                        getBaseView().initData2View(successOb.page);
                    }
                }
            }

            @Override
            public void onFailure(Object failureObj) {
                if (getBaseView() != null) {
                    getBaseView().showRootLayoutStatus(3);
                }
            }
        });
    }

    public void refuse(String fId) {
        NetWorkUtils.getInstance().refuse(fId, new CommonResponseListener<BaseBean>() {
            @Override
            public void onSuccess(BaseBean successOb, String result) {
                if (ResponseUtils.getInstance().isNoError(successOb)) {
                    if (getBaseView() != null) {
                        getBaseView().unAgreeSuccess();
                    }
                }
            }

            @Override
            public void onFailure(Object failureObj) {

            }
        });
    }

    public void remindFriends(String fId) {
        NetWorkUtils.getInstance().remindFriends(fId, new CommonResponseListener<BaseBean>() {
            @Override
            public void onSuccess(BaseBean successOb, String result) {
                if (ResponseUtils.getInstance().isNoError(successOb)) {
                    if (getBaseView() != null) {
//                        getBaseView().tipSuccess();
                    }
                }
            }

            @Override
            public void onFailure(Object failureObj) {

            }
        });
    }
}
